@import "variables";
@import "font-face";
@import "markdown";
@import "utils";

html {
  font-size: $font-size-base;
  letter-spacing: 0.33px;
  scroll-behavior: smooth;
}

html,
body {
  min-width: $body-min-width;
  overflow-x: hidden;
}

body {
  color: $body-font-color;
  background: $body-background;

  font-family: "Open Sans", Helvetica, sans-serif;
  font-weight: $body-font-weight;

  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  box-sizing: border-box;

  * {
    box-sizing: inherit;
  }
}

h1,
h2,
h3,
h4,
h5 {
  font-weight: 400;
}

a {
  text-decoration: none;
  color: $color-link;

  &:visited {
    color: $color-visited-link;
  }
}

img {
  vertical-align: middle;
}

aside nav ul {
  padding: 0;
  margin: 0;
  list-style: none;

  li {
    margin: 1em 0;
  }

  a {
    display: block;
  }

  a:hover {
    opacity: .5;
  }

  ul {
    padding-left: $padding-16;
  }
}

ul.pagination {
  display: flex;
  justify-content: center;

  .page-item a {
    padding: $padding-16;
  }
}

.container {
  min-width: $container-min-width;
  max-width: $container-max-width;
  margin: 0 auto;
}

.book-brand {
  margin-top: 0;
}

.book-menu {
  flex: 0 0 $menu-width;
  font-size: $font-size-14;
  padding: 0 20px 0 0;


  nav {
    width: $menu-width;
    padding: $padding-16;
    @include fixed;
    z-index: 11;
    background: $gray-100;

    li.level1 {
      margin-left: 16px;

      &.has-children {
        margin-left: 0px;

        figure.menu-arrow {
          margin: 0;
          display: inline-block;

          img {
            margin-right: 2px;
            width: 10px;
          }
        }

        &.active figure.menu-arrow img {
          transform: rotate(90deg);
        }
      }

      & > a {
        display: inline-block;
      }
    }

    @media (min-width: 44rem) {
      border-right: 1px solid $gray-200;
    }
  }

  @include dark-links;
}

.book-page {
  padding: 0 50px;

  a {
    font-weight: 600;
  }
}

.book-header {
  margin-bottom: $padding-16;
  display: none;
}

.book-toc {
  flex: 0 0 $toc-width;
  font-size: $font-size-12;

  nav {
    width: $toc-width;
    padding: $padding-16;

    @include fixed;
    // left: 12px;
  }

  nav > ul > li {
    margin: 0;
  }
}

.book-git-footer {
  display: flex;
  margin-top: 4 * $padding-16;
  font-size: $font-size-14;
  align-items: baseline;

  img {
    width: $font-size-14;
    vertical-align: bottom;
  }
}

.book-posts {
  min-width: $body-min-width;
  max-width: $sm-breakpoint;
  padding: $padding-16;

  article {
    padding-bottom: $padding-16;
  }
}

// Responsive styles
aside nav,
.book-page,
.book-posts,
.markdown {
  transition: 0.2s ease-in-out;
  transition-property: transform, margin-left, opacity;
  will-change: transform, margin-left;
}

@media screen and (max-width: $md-breakpoint) {
  .book-toc {
    display: none;
  }
}

@media screen and (max-width: $sm-breakpoint) {
  .book-menu {
    margin-left: -$menu-width;
  }

  .book-header {
    display: flex;
  }

  #menu-control:checked + main {
    .book-menu nav,
    .book-page,
    .book-posts {
      transform: translateX($menu-width);
    }

    .book-header label {
      transform: rotate(90deg);
    }

    .markdown {
      opacity: 0.25;
    }
  }

  .book-git-footer {
    #suggest-edits {
      display: none;
    }
  }
}

// Extra space for big screens
@media screen and (min-width: $container-max-width) {
  // .book-page,
  .book-menu nav,
  .book-toc nav {
    padding: $padding-16 * 2 0 $padding-16 * 2 $padding-16;
  }
}

img.icon {
  width: 200px;
  height: 150px;
}

h1, h2, h3 {
  padding-top: 20px;
}

h3 {
  font-weight: bold;
}

pre::-webkit-scrollbar {
  height: 8px;
}

.search-input-container {
  padding: 6px;
  transition: top .5s ease;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .07);
  margin-bottom: 10px;
  margin-right: 1rem;

  input {
    width: 100%;
    background: 0 0;
    border: 1px solid transparent;
    box-shadow: none;
    outline: 0;
    padding: 7px 7px;
    color: inherit;
  }
}

.has-results {
  margin-top: 30px;

  ul {
    list-style: none;

    li {
      margin-bottom: 20px;

      div {
        margin-top: 5px;
        line-height: 22px;
      }
    }
  }
}

//new styles


.main-container {
  display: flex;
}

.book-page {
  max-width: $main-column-max-width;
  padding: 0 50px 50px;

  &.toc-hidden {
    max-width: $main-column-max-width + $toc-width;
  }
}

.book-toc {

  a {
    color: #333;
    text-decoration: none;
  }

  ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
  }

  nav ul > li {
    margin-bottom: 10px;

    a {
      font-size: 16px;
    }

  }

  nav ul > li ul li {
    margin: 10px 0;

    a {
      font-size: 13px;
    }

  }

  nav ul > li ul li ul > li {
    font-weight: 600;
    margin: 5px 0;
    font-size: 13px;
    padding-left: 10px;
  }

  nav ul > li ul li ul > li > ul li a {
    font-weight: normal;
    font-size: 13px;
    margin-bottom: 10px;
  }

  nav ul > li ul li ul > li > ul {

    font-weight: normal;
    margin-left: 20px;

  }
}

.navigation-bar {
  visibility: hidden;
  background: $white;
  display: flex;
  position: fixed;
  top: 0;
  width: 100%;
  padding: 5px 2rem 5px 2rem;
  z-index: 10;
  justify-content: space-between;
  @media (min-width: $desktop) {
    padding: 5px 2rem 5px 23rem;
  }
}

a.navigation {
  color: #333;
  font-size: $font-size-14;
  border: 0.5px solid black;
  border-radius: 5px;
  padding: 4px;
  visibility: hidden;
}

.search-results-title {
  text-align: left;
  font-weight: 200;
  margin: 0 0 35px 40px;
  font-size: 20px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 10px;
}

.search-query {
  font-weight: 600;
  font-size: 22px;
}

.main-page-toc-container {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;

  & a[href^='http']:after {
    content: url('../images/external-link-ltr-icon.png');
    margin-left: 3px;
    position: absolute;
  }

  & ul.noindent {
    margin-left: -24px;
  }

  .main-page-toc-column {
    width: 50%;
    display: inline-block;
    padding-left: 10px;
    padding-right: 10px;
    justify-content: space-between;

    @media screen and (max-width: $md-breakpoint) {
      width: 100%;
      display: block;
    }
  }

}
